using System.Collections.Generic;
using YF.Art.PostProcessing;

public class PostProcessingManager : Singleton<PostProcessingManager>
{
    private List<YFPostProcessing> postProcessings = new List<YFPostProcessing>();

    public void pushYFPostProcessing(YFPostProcessing postProcessing)
    {
        foreach (var item in this.postProcessings)
        {
            // 其他相机停止后效
            item.EffPause();
        }

        // 最新相机处理后效
        postProcessing.EffResume();

        this.postProcessings.Add(postProcessing);
    }

    public void popYFPostProcessing(YFPostProcessing postProcessing)
    {
        this.postProcessings.Remove(postProcessing);

        for (int i = 0; i < this.postProcessings.Count; i++)
        {
            if (i == this.postProcessings.Count - 1)
            {
                // 最后一个相机处理后效
                this.postProcessings[i].EffResume();
            }
            else
            {
                // 其他相机停止后效
                this.postProcessings[i].EffPause();
            }
        }
    }

    public override void Dispose()
    {
    }
}